import Request from '@/libs/request'

/**查询待办事项 */
export const selectNotHanderWork = (data: {userDDId: string}) =>
  Request.get<WorkTask.Task[]>('/workTask/selectNotHanderWork', data)

/**查询已办事项 */
export const selectHanderWork = (data: {userDDId: string}) =>
  Request.get<WorkTask.Task[]>('/workTask/selectHanderWork', data)

/* 查询待办和已办数量 */
export const selectWorkTaskCountApi = (data: {userDDId: string}) => {
  return Request.get<WorkTaskCountType>('/workTask/selectWorkTaskCount', data)
}

/* 分页查询待办事项 */
export const selectNotHanderWorkByPageApi = (data: {
  userDDId: string
  page: number
  size: number
}) => {
  return Request.get<TaskListType>('/workTask/selectNotHanderWorkByPage', data)
}

/* 分页查询已办事项 */
export const selectHanderWorkByPageApi = (data: {userDDId: string; page: number; size: number}) => {
  return Request.get<TaskListType>('/workTask/selectHanderWorkByPage', data)
}

// 待办和已办数量类型
interface WorkTaskCountType {
  waitWorkTaskCount: number
  completeWorkTaskCount: number
}

// 任务列表类型
type TaskListType = TaskType[]

// 任务类型
interface TaskType {
  workTaskId: number
  workTaskContent: string
  createTime: string
  userDDId: string
  handerStatus: number
  taskId: string
  pmId: number
  pmProgressId: number
  avator: string
}
